#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const int N = 1e3 + 10;
int n;
typedef struct
{
	double x1, y1;
	double x2, y2;
}S;
S s[N];
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i].x1 >> s[i].y1 >> s[i].x2 >> s[i].y2;
	}
	double a1, b1, c1, d1;
	cin >> a1 >> b1 >> c1 >> d1;
	double k1 = (d1 - b1) / (c1 - a1);
	k1 = abs(k1);
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			double a = (s[i].x2 + s[j].x1)*1.0 / 2;
			double b = (s[i].y2 + s[j].y1)*1.0 / 2;
			double k = b*1.0 / a;
			k = abs(k);
			if (abs(k-k1)<1e-8) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}